package com.hxzy.system.service.impl;

import com.hxzy.common.core.domain.entity.DictData;
import com.hxzy.system.dto.DictDataDTO;
import com.hxzy.system.mapper.DictDataMapper;
import com.hxzy.system.service.DictDataService;
import javafx.scene.control.Pagination;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 功能描述
 *
 * @author tonneyyy
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class DictDataServiceImpl extends CommonServiceImpl<DictData,Long> implements DictDataService{

    private DictDataMapper dictDataMapper;

    @Autowired
    public void setDictDataMapper(DictDataMapper dictDataMapper) {
        this.dictDataMapper = dictDataMapper;
        super.setMyBatisBaseDao(dictDataMapper);
    }


    @Override
    public List<DictData> selectDictDataByType(String dictType) {
        return this.dictDataMapper.selectDictDataByType(dictType);
    }

    @Override
    public List<DictData> search(DictDataDTO dictDataDTO) {
        return this.dictDataMapper.search(dictDataDTO);
    }

    @Override
    public void deleteDictDataByIds(Long[] dictCodes) {
        for(Long dictId : dictCodes){
            this.dictDataMapper.deleteByPrimaryKey(dictId);
        }
    }
}
